package com.ordertracker.client;

import com.ordertracker.entity.Employee;
import com.ordertracker.entity.User;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
import java.util.Date;
import java.util.Map;

/**
 * Description of class.
 * Created 1/18/13 5:01 PM
 *
 * @author andrey.rodin@playtech.com
 */

@XmlRootElement
public final class ClientSession implements Serializable {
    private static final long serialVersionUID = 7346999355799039426L;

    private String sessionToken;
    private String sessionKey;
    private byte[] sessionSecret;
    private User user;
    private Date createDate;
    private String timezone;
    private String locale;
    private Map<String, String> properties;

    public ClientSession() {
    }

    public ClientSession(String sessionToken, String sessionKey, byte[] sessionSecret, User user, Date createDate,
                         String timezone, String locale, Map<String, String> properties) {
        this.sessionToken = sessionToken;
        this.sessionKey = sessionKey;
        this.sessionSecret = sessionSecret;
        this.user = user;
        this.createDate = createDate;
        this.timezone = timezone;
        this.locale = locale;
        this.properties = properties;
    }

    @XmlElement(nillable = false)
    public String getSessionToken() {
        return sessionToken;
    }

    @XmlElement(nillable = false)
    public String getSessionKey() {
        return sessionKey;
    }

    @XmlElement(nillable = false)
    public byte[] getSessionSecret() {
        return sessionSecret;
    }

    @XmlElement(nillable = false)
    public User getUser() {
        return user;
    }

    @XmlElement(nillable = false)
    public Date getCreateDate() {
        return createDate;
    }

    @XmlElement
    public String getTimezone() {
        return timezone;
    }

    @XmlElement
    public String getLocale() {
        return locale;
    }

    @XmlElement
    public String getProperty(String key) {
        return properties.get(key);
    }

    @XmlElement(nillable = true)
    public Map<String, String> getProperties() {
        return properties;
    }

    public void setSessionToken(String sessionToken) {
        this.sessionToken = sessionToken;
    }
}
